package com.qdu;

import com.qdu.filter.CrossDomainFilter;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

/*启动类在哪从哪开始扫，启动类在所有的最外边,这个就得写到etoak外边*/
@SpringBootApplication
@MapperScan(basePackages = "com.qdu.mapper")//相当于MapperScannerConfig
public class HouseApp {
    public static void main(String[] args) {
        SpringApplication.run(HouseApp.class, args);
    }

   @Bean
    public FilterRegistrationBean<CrossDomainFilter> crossDomainFilter(){
        FilterRegistrationBean<CrossDomainFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new CrossDomainFilter());
        registrationBean.addUrlPatterns("/*");
        return registrationBean;
    }

}
